package Send2ME::Dao::User;

use Exporter 'import';

@EXPORT = qw(USER_TABLE createUser updateUser getUser);

use Dancer ':syntax';
use Dancer::Plugin::Database;

use constant USER_TABLE => 'users';

sub createUser {
	my $params = shift;
	return database->quick_insert(USER_TABLE, $params);
}

sub getUser {
	my $params = shift;
	return database->quick_select(USER_TABLE, $params);
}

sub updateUser {
	my $user = shift;
	return database->quick_update(USER_TABLE, { id => $user->{id} },  $user);
}

1;

